<template>
	<div class="content_box">
		<div class="finance_table_box ">
			<finance-search></finance-search>
			<el-table :data="payments" stripe style="width: 100%">
				<el-table-column prop="company_name" label="发票抬头"></el-table-column>
				<el-table-column prop="price" label="开票金额">
					<template scope="scope">
						<span>{{scope.row.price | conver_money}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="created_at" label="申请时间">
					<template scope="scope">
						<span>{{ new Date(scope.row.created_at * 1000).Format("yyyy-MM-dd") }}</span>
					</template>
				</el-table-column>
				<el-table-column prop="handle_type" label="开票状态">
					<template scope="scope">
						<el-tag :type="conver_invoice(scope.row.handle_type).type">{{conver_invoice(scope.row.handle_type).str}}</el-tag>
					</template>
				</el-table-column>
				<el-table-column prop="updated_at" label="开票时间">
					<template scope="scope">
						<span>{{ new Date(scope.row.updated_at * 1000).Format("yyyy-MM-dd") }}</span>
					</template>
				</el-table-column>
			</el-table> 
			<div class='page'>
				<el-pagination commonsmall @current-change='handlePafe' layout="prev, pager, next" :page-size="financePage.current_total" :total="financePage.total_count"></el-pagination>
			</div>
		</div>
	</div>
</template>
<script>
	import filters from '../../../utils/filters'
	import { mapActions, mapState, mapGetters } from 'vuex'
	import Search from './Search.vue'
//	import { getLocalStorage } from '@/utils/auth.js'
	export default {
		data() {
			return {
//				real_name: getLocalStorage(),
				activeName1: 'expense',
				page: { next_page: 1, total_count: 10, total_pages: 1 },
				tableData: [],
			}
		},
		computed: {...mapGetters(['payments', 'financePage', 'financeTab', 'financeVisi','current_user'])},
		components: {
			'finance-search': Search,
		},
		created() {
			if(!this.financeVisi.visibled) {
				this.getInvoice({ id: this.current_user.id, page: this.page.next_page, limit: 10 })
			}
		},
		methods: {
			conver_invoice: filters.conver_invoice,
			...mapActions(['getInvoice']),
			handleClick() {
				this.getInvoice({ page: this.page.next_page, limit: 10 })
				this.tableData=payments
			},
			handlePafe(e) {
				this.getFinance({ kind: this.activeName1, page: e, limit: 10 })
			}
		}
	}
</script>
<!--<style lang='scss' scoped>
	.content_box {
		padding: 40px 0px;
		background: #f9fafc;
	}
	
	.finace_back {
		background: #fff;
	}
	
	.finance_table_box {
		>.finance_table:nth-child(2) {
			padding: 0px 40px 0px 0px;
		}
		margin-left:19px;
		.finance_table {
			display: flex;
			padding: 0px 40px 40px 0px;
		}
		.page {
			text-align: right;
			padding: 0px 40px 40px 0px;
		}
	}
</style>-->